<?php
//module thoi tiet, ty gia, gia vang, cophieu - VNEXPESS

class Common_m extends MY_Model{
	function __construct(){
		parent::__construct();
	}
	
	function block(){
		$params = func_get_args();
		$data = array();
		foreach((array)$params[0] as $item=>$key){
			if($key == 1)
				$data[] = $item;
		}
		$str_data = join(',',$data);
		return $this->template
			->set_layout(FALSE)
			->set('str_data',$str_data)
			->build('common/block');
	}
	
	function get_url($request_url) {		
	
	  $ch = curl_init();
	  $headers = array("Content-Type: application/json");
	  curl_setopt($ch, CURLOPT_URL, $request_url);
	 // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	  $response = curl_exec($ch);
	  return $response;
	}
}